<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Firmware for Arduino | PLEN Project Company Inc.: PLEN2::ExternalEEPROM Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Firmware for Arduino | PLEN Project Company Inc.
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">PLEN2::ExternalEEPROM Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Management class of external EEPROM.  
 <a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_external_e_e_p_r_o_m_8h_source.html">ExternalEEPROM.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a8aebdbedd670c2ae9b83c5efb0f316ea"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a8aebdbedd670c2ae9b83c5efb0f316eaa3b6c8317e8268a5fb896923c4a8433d2">CHUNK_SIZE</a> = 32
 }</td></tr>
<tr class="memdesc:a8aebdbedd670c2ae9b83c5efb0f316ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Chunk size of external EEPROM (bytes)  <a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a8aebdbedd670c2ae9b83c5efb0f316ea">More...</a><br /></td></tr>
<tr class="separator:a8aebdbedd670c2ae9b83c5efb0f316ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a384e612e5373158f853e5e7efb2dc679"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a384e612e5373158f853e5e7efb2dc679aa893a7791ec868480f4576b02e8a3c98">SLOT_SIZE</a> = CHUNK_SIZE - ADDRESS_BYTES
 }</td></tr>
<tr class="memdesc:a384e612e5373158f853e5e7efb2dc679"><td class="mdescLeft">&#160;</td><td class="mdescRight">Slot size of external EEPROM (bytes)  <a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a384e612e5373158f853e5e7efb2dc679">More...</a><br /></td></tr>
<tr class="separator:a384e612e5373158f853e5e7efb2dc679"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d9154051d9835a3a062605770ebbac2"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a1d9154051d9835a3a062605770ebbac2a6391779cbbc4ba84b717ccfbd6a00fd4">SLOT_BEGIN</a> = 0
 }</td></tr>
<tr class="memdesc:a1d9154051d9835a3a062605770ebbac2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Beginning value of slots.  <a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a1d9154051d9835a3a062605770ebbac2">More...</a><br /></td></tr>
<tr class="separator:a1d9154051d9835a3a062605770ebbac2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adf55bead9b5cbfa994d855a89b61fc0f"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom">{ <a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#adf55bead9b5cbfa994d855a89b61fc0faada4fde0f7a073c7708de50f32336a33">SLOT_END</a> = SIZE / CHUNK_SIZE
 }</td></tr>
<tr class="memdesc:adf55bead9b5cbfa994d855a89b61fc0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">End value of slots.  <a href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#adf55bead9b5cbfa994d855a89b61fc0f">More...</a><br /></td></tr>
<tr class="separator:adf55bead9b5cbfa994d855a89b61fc0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6de9ba73e5c1c5e68eeca23939cd19f0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a6de9ba73e5c1c5e68eeca23939cd19f0">ExternalEEPROM</a> ()</td></tr>
<tr class="memdesc:a6de9ba73e5c1c5e68eeca23939cd19f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a6de9ba73e5c1c5e68eeca23939cd19f0">More...</a><br /></td></tr>
<tr class="separator:a6de9ba73e5c1c5e68eeca23939cd19f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ab2fbe055be630b7a150120a1b0d78741"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#ab2fbe055be630b7a150120a1b0d78741">begin</a> ()</td></tr>
<tr class="memdesc:ab2fbe055be630b7a150120a1b0d78741"><td class="mdescLeft">&#160;</td><td class="mdescRight">Static constructor.  <a href="#ab2fbe055be630b7a150120a1b0d78741">More...</a><br /></td></tr>
<tr class="separator:ab2fbe055be630b7a150120a1b0d78741"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa427fcc2ddee1e2defc5d010f8277201"><td class="memItemLeft" align="right" valign="top">static int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#aa427fcc2ddee1e2defc5d010f8277201">readSlot</a> (uint16_t slot, uint8_t data[], uint8_t read_size)</td></tr>
<tr class="memdesc:aa427fcc2ddee1e2defc5d010f8277201"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a slot of external EEPROM.  <a href="#aa427fcc2ddee1e2defc5d010f8277201">More...</a><br /></td></tr>
<tr class="separator:aa427fcc2ddee1e2defc5d010f8277201"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99d218ed84e338400dbd857b2c95a9bc"><td class="memItemLeft" align="right" valign="top">static int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html#a99d218ed84e338400dbd857b2c95a9bc">writeSlot</a> (uint16_t slot, const uint8_t data[], uint8_t write_size)</td></tr>
<tr class="memdesc:a99d218ed84e338400dbd857b2c95a9bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a slot of external EEPROM.  <a href="#a99d218ed84e338400dbd857b2c95a9bc">More...</a><br /></td></tr>
<tr class="separator:a99d218ed84e338400dbd857b2c95a9bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Management class of external EEPROM. </p>
<dl class="section note"><dt>Note</dt><dd>24FC1025 supports the access to 128 bytes at once, but Arduino's I2C library doesn't support it because the library's buffer size is 32 bytes. <br />
<br />
 Please pay attention to the fact that it is including bytes of targeted area address (= 2 bytes). The accurate data size that you can write is 30 bytes. (This is why there are differences between CHUNK_SIZE and SLOT_SIZE.) </dd></dl>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="a8aebdbedd670c2ae9b83c5efb0f316ea"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Chunk size of external EEPROM (bytes) </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="a8aebdbedd670c2ae9b83c5efb0f316eaa3b6c8317e8268a5fb896923c4a8433d2"></a>CHUNK_SIZE&#160;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="a384e612e5373158f853e5e7efb2dc679"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Slot size of external EEPROM (bytes) </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="a384e612e5373158f853e5e7efb2dc679aa893a7791ec868480f4576b02e8a3c98"></a>SLOT_SIZE&#160;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="a1d9154051d9835a3a062605770ebbac2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Beginning value of slots. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="a1d9154051d9835a3a062605770ebbac2a6391779cbbc4ba84b717ccfbd6a00fd4"></a>SLOT_BEGIN&#160;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="adf55bead9b5cbfa994d855a89b61fc0f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">anonymous enum</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>End value of slots. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="adf55bead9b5cbfa994d855a89b61fc0faada4fde0f7a073c7708de50f32336a33"></a>SLOT_END&#160;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a6de9ba73e5c1c5e68eeca23939cd19f0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">PLEN2::ExternalEEPROM::ExternalEEPROM </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructor. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab2fbe055be630b7a150120a1b0d78741"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void PLEN2::ExternalEEPROM::begin </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Static constructor. </p>

</div>
</div>
<a class="anchor" id="aa427fcc2ddee1e2defc5d010f8277201"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int8_t PLEN2::ExternalEEPROM::readSlot </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>data</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>read_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Read a slot of external EEPROM. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">slot</td><td>Please set slot number you want to read. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data[]</td><td>Please set buffer to store reading data. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">read_size</td><td>Please set buffer size.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">!0</td><td>Succeeded. (Generally, the value equals <b>read-size</b>.) </td></tr>
    <tr><td class="paramname">-1</td><td>Failed. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a99d218ed84e338400dbd857b2c95a9bc"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int8_t PLEN2::ExternalEEPROM::writeSlot </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t&#160;</td>
          <td class="paramname"><em>data</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>write_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Write a slot of external EEPROM. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">slot</td><td>Please set slot number you want to write. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data[]</td><td>Please set buffer that stored writing data. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">write_size</td><td>Please set buffer size.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>Succeeded. </td></tr>
    <tr><td class="paramname">-1</td><td>Argument error. (<b>write_size</b> is bigger than slot size.) </td></tr>
    <tr><td class="paramname">1</td><td>Sending-buffer overflow. </td></tr>
    <tr><td class="paramname">2</td><td>Received NACK after sending slave address. </td></tr>
    <tr><td class="paramname">3</td><td>Received NACK after sending data bytes. </td></tr>
    <tr><td class="paramname">4</td><td>Other errors were raised.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section attention"><dt>Attention</dt><dd>Writing external EEPROM requires time. (Typically using 3[msec].) In the implementation, 5[msec] delay is inserted at the end of the method. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_external_e_e_p_r_o_m_8h_source.html">ExternalEEPROM.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_p_l_e_n2.html">PLEN2</a></li><li class="navelem"><a class="el" href="class_p_l_e_n2_1_1_external_e_e_p_r_o_m.html">ExternalEEPROM</a></li>
    <li class="footer">Generated on Tue Oct 11 2016 13:20:21 for Firmware for Arduino | PLEN Project Company Inc. by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
